// src/router/index.jsx
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Home from '../pages/Home';
import About from '../pages/About';
import TodoList from "../pages/TodoList.jsx";
import SecondTo from "../pages/SecondTo.jsx";
import User from '../pages/User';
import Index from '../pages/index.jsx';
import Login from '../pages/Login.tsx';
import MainLayout from '../layout/MainLayout'; // 导入布局组件
import Register from '../pages/Register.jsx';

const AppRouter = () => {
    return (
        <Router>
            <Routes>
                <Route path='/' element={<Login />} /> {/* 登录页面不显示导航栏 */}
                <Route path="/" element={<MainLayout />}> {/* 使用 MainLayout 作为父路由 */}
                    <Route path="home" element={<Home />} />
                    <Route path="about" element={<About />} />
                    <Route path="second" element={<SecondTo />} />
                    <Route path="todo" element={<TodoList />} />
                    <Route path="user" element={<User />} />
                    <Route path="index" element={<Index />} />
                    <Route path='register' element={<Register/>}/>
                </Route>
            </Routes>
        </Router>
    );
};

export default AppRouter;